import React from 'react';
import ReactDOM from 'react-dom';
import './common.css';
import registerServiceWorker from './registerServiceWorker';
import Home from './Home';
import { BrowserRouter as Router, Route, Link, Switch} from 'react-router-dom';
import createHistory from 'history/createBrowserHistory';
import Details from './Component/details/Details';
import Question from './Component/question/Question';
import Login from './Component/auth/Login';
import Register from './Component/auth/Register';
import Result from './Component/result/result';
import Analysis from './Component/analysis/Analysis';
import User from './Component/user/User';
import Help from './Component/user/componment/Help';
import Bought from './Component/user/componment/Bought';
import TestLog from './Component/user/componment/TestLog';
import Recharge from './Component/user/componment/Recharge';
import VipPage from './Component/vip/VipPage';
import AppRecharge from './Component/appAction/AppRecharge';
import OpenApp from './Component/appAction/OpenApp';

let history = createHistory();

ReactDOM.render(
    <Router>
        <Switch>
            <Route  exact path="/" component={Home} />
            <Route history={history} exact path="/detail/:bookId" component={Details} />
            <Route history={history}  exact path="/exam/:id" component={Question} />
            <Route history={history} exact path="/login" component={Login} />
            <Route history={history} exact path="/register" component={Register} />
            <Route history={history} exact path="/result" component={Result} />
            <Route history={history} exact path="/analysis/:id" component={Analysis} />

            <Route history={history} exact path="/user" component={User} />
            <Route history={history} exact path="/help" component={Help} />
            <Route history={history} exact path="/bought" component={Bought} />
            <Route history={history} exact path="/test/log" component={TestLog} />
            <Route history={history} exact path="/result/history" component={Result} />
            <Route history={history} exact path="/recharge" component={Recharge} />

            <Route history={history} exact path="/buy_vip" component={VipPage} />

            <Route history={history} exact path="/app/buy_vip/:id" component={AppRecharge} />
            <Route history={history} exact path="/app/open" component={OpenApp} />

        </Switch>
    </Router>
    , document.getElementById('root'));
registerServiceWorker();
